package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Tenth_b;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Tenth_bMapper {


    @Select({
            "select",
            "*",
            "from Tenth_b",
            "where hosptial = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Tenth_b> selectByName(String oName);
    @Delete({
            "delete from Tenth_b",
            "where hosptial = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);
    int insertBatch(List<Tenth_b> item);
    @Delete({
        "delete from tenth_b",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into tenth_b (hosptial, source, ",
        "project_name, count)",
        "values (#{hosptial,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, ",
        "#{projectName,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Tenth_b record);

    int insertSelective(Tenth_b record);

    @Select({
        "select",
        "id, hosptial, source, project_name, count",
        "from tenth_b",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Tenth_b selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Tenth_b record);

    @Update({
        "update tenth_b",
        "set hosptial = #{hosptial,jdbcType=VARCHAR},",
          "source = #{source,jdbcType=VARCHAR},",
          "project_name = #{projectName,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Tenth_b record);
}